#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPixmap>

QT_BEGIN_NAMESPACE
class QToolButton;
class QAction;
class QTranslator;
class CenterWindow;
class Config;
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

signals:
    void signalLanguageChanged();

protected:
    void paintEvent(QPaintEvent *);

private slots:
    // tool button functions
    void slotAddFiles();
    void slotAddDir();
    void slotSelectAll();
    void slotDeleteSelected();
    void slotShowLanguageMenu();
    void slotChangePreferences();
    void slotShowSystemHelpMenu();
    // help menu functions
    void slotHelpHelp();
    void slotHelpBuy();
    void slotHelpRegister();
    void slotHelpFeedback();
    void slotHelpUpdate();
    void slotHelpAbout();
    // language menu clicked
    void slotLanMenuClicked(QAction *);
    // language changed
    void slotLanguageChanged(int);
    // file selection changed
    void slotFileSelectionChanged(bool,bool);
private:
    void createActions();
    void createToolBars();
    QToolButton *createToolButton(const QString&,const QString&,const QString&,
                                  const QString&,const QString&,
                                  QKeySequence::StandardKey key = QKeySequence::UnknownKey);
    void updateTranslator();
    void updateUiLanguage();
    void updateToolBarLanguage();
    // toolbar
    QToolBar *m_mainToolBar;
    // tool buttons on toolbar
    QToolButton *m_addFileButton;
    QToolButton *m_addDirButton;
    QToolButton *m_selectAllButton;
    QToolButton *m_delSelectedButton;
    QToolButton *m_changeLanguageButton;
    QToolButton *m_preferenceButton;
    QToolButton *m_systemHelpButton;
    // lan menu
    QMenu *m_languageMenu;
    // help menu
    QMenu *m_systemHelpMenu;
    // help menu actions
    QAction *m_helpHelpAct;
    QAction *m_helpBuyAct;
    QAction *m_helpRegisterAct;
    QAction *m_helpFeedbackAct;
    QAction *m_helpUpdateAct;
    QAction *m_helpAboutAct;
    // center frame
    CenterWindow *m_centerFrame;
    // open file path
    QString openFilesPath;
    // bg image
    QPixmap m_background;
    QList<QAction *> m_lanActList;
    // config pointer
    Config *m_config;
    // translator
    QTranslator  * m_translator;
};

#endif // MAINWINDOW_H
